package br.edu.ufra.modelo;

//import javax.persistence.*;
import java.util.Collection;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;
import javax.validation.constraints.Digits;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

@Entity
@Table(name = "Vlan")
public class Vlan {
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Integer id;
	@Column(unique = true, length = 15, nullable = false)
	private String rede;
	
	@Column(unique = true, length = 15, nullable = false)
	private String mask;
	
	@Column(unique = true, length = 32, nullable = false)
	private String predio;

	@Column(nullable = false)
	@NotNull
	@Digits(message = "Somente numero de, minimo=1 maximo 254", fraction = 0, integer = 1)
	@Size(message = "Somente numero de, minimo=1 maximo 254", max = 254, min = 1)
	private int inicio;
	@Column(nullable = false)
	@NotNull
	@Digits(message = "Somente numero de, minimo=1 maximo 254", fraction = 0, integer = 1)
	@Size(message = "Somente numero de, minimo=1 maximo 254", max = 254, min = 1)
	private int fim;

	@Column(length = 15, nullable = false)
	private String gateway;
	@Column(length = 15, nullable = false)
	private String dnsPrimario;
	@Column(length = 15)
	private String dnsSecundario;
	@Column(length = 15)
	private String wins;
	@Column(length = 15, nullable = false)
	private String broadcast;
	@Column(length = 15)
	private String proxy;
	@Column(length = 128)
	private String cmdDhcp;

	@OneToMany(mappedBy = "vlan", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
	@OrderBy("vlan")
	private Collection<Ponto> ponto;

	public Collection<Ponto> getPonto() {
		return ponto;
	}

	public void setPonto(Collection<Ponto> ponto) {
		this.ponto = ponto;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public void setRede(String rede) {
		this.rede = rede;
	}

	public String getRede() {
		return rede;
	}

	public void setIp(String rede) {
		this.rede = rede;
	}

	public String getPredio() {
		return predio;
	}

	public void setPredio(String predio) {
		this.predio = predio;
	}

	public int getInicio() {
		return inicio;
	}

	public void setInicio(int inicio) {
		this.inicio = inicio;
	}

	public int getFim() {
		return fim;
	}

	public void setFim(int fim) {
		this.fim = fim;
	}

	public String getGateway() {
		return gateway;
	}

	public void setGateway(String gateway) {
		this.gateway = gateway;
	}

	public String getDnsPrimario() {
		return dnsPrimario;
	}

	public void setDnsPrimario(String dnsPrimario) {
		this.dnsPrimario = dnsPrimario;
	}

	public String getDnsSecundario() {
		return dnsSecundario;
	}

	public void setDnsSecundario(String dnsSecundario) {
		this.dnsSecundario = dnsSecundario;
	}

	public String getWins() {
		return wins;
	}

	public void setWins(String wins) {
		this.wins = wins;
	}

	public String getBroadcast() {
		return broadcast;
	}

	public void setBroadcast(String broadcast) {
		this.broadcast = broadcast;
	}

	public String getProxy() {
		return proxy;
	}

	public void setProxy(String proxy) {
		this.proxy = proxy;
	}

	public String getCmdDhcp() {
		return cmdDhcp;
	}

	public void setCmdDhcp(String cmdDhcp) {
		this.cmdDhcp = cmdDhcp;
	}

	public void setMask(String mask) {
		this.mask = mask;
	}

	public String getMask() {
		return mask;
	}

}
